$('.mail-header').html('<h5>' + BuMenName + '统计数据</h5>');
$('#Refer').click(function() {
  if (!$('#BeginTime').val()) {
    alert('请选择开始日期！');
    return;
  }
  if (!$('#EndTime').val()) {
    alert('请选择结束日期！');
    return;
  }
  $.getJSON('TongJi.php', {
      BuMenId: BuMenId,
      BeginTime: $('#BeginTime').val(),
      EndTime: $('#EndTime').val()
    },
    function(data, textStatus, jqXHR) {
      $('#HuiZong').html('<h4>合计提交<b>' + data.allnum + '</b>个，通过<b>' + data.agree + '</b>个，驳回<b>' + data.disagree + '</b>个，待审核<b>' + data.waitnum + '</b>个，有效工时<b>' + data.hours + '小时' + data.Minutes + '分钟</b>，结算金额<b>' + data.allPay + '</b>元。</h4>');
      $('#ListArea').empty();
      for (let i = 0; i < data['list'].length; i++) {
        $('#ListArea').append(
          '<tr>  ' +
          '  <td>' + (i + 1) + '</td><td>' + data['list'][i].XingMing + '</td><td>' + data['list'][i].XueHao + '</td><td>' + data['list'][i].CiShu + '</td><td>' + data['list'][i].hours + '小时' + data['list'][i].Minutes + '分钟</td><td>' + data['list'][i].Pay + '</td> ' +
          '</tr>'
        );
      }
    }
  );
})
$('#Export').click(function() {
  if (!$('#BeginTime').val()) {
    alert('请选择开始日期！');
    return;
  }
  if (!$('#EndTime').val()) {
    alert('请选择结束日期！');
    return;
  }
  window.open('TongJi_export.php?BuMenId=' + BuMenId + '&BeginTime=' + $('#BeginTime').val() + '&EndTime=' + $('#EndTime').val());
})
